﻿@model WebUI.Models.Catalog
@{string depid=ViewBag.DepID as string;}
<div>
    <input name="cata" id="c_@(Model.CatalogID)" type="checkbox" onchange="$('#s_@(Model.CatalogID) :checkbox').prop('checked',$(this).prop('checked'));" />
    <label for="c_@(Model.CatalogID)" >
        [@Model.Title]</label>
</div>
@if (Model.SubCatalogs.Count > 0 || Model.QizItems.Count > 0)
{
    <ul id="s_@(Model.CatalogID)">
        @foreach (var item in Model.SubCatalogs)
        {
            <li class="closed">
                @Html.Partial("SuiFangTree2", item) </li>
        }
        @if (Model.QizItems.Count > 0)
        {
            <li>
                @{var qids=ViewBag.QIDS  as string[];}
                @foreach (var item in Model.QizItems.Where(v => !qids.Contains(v.QizItemID) && v.QizItemToDeps.Any(t=>t.DepID==depid||t.DepID=="10001")))
                {
                    <span style="border: 1px solid gray; padding: 1px; margin: 1px;">
                        <input name="Selection" type="checkbox" value='@item.QizItemID' id='I_@(item.QizItemID)'/>
                        <label title='@("" + item.Title + ":" + item.TypeRef.OptionTitle + ((item.TypeRef.OptionValue == "4" || item.TypeRef.OptionValue == "5") ? ":" + (item.EnumDefine == null ? "**选择项被意外删除" : item.EnumDefine.EnumName) : string.Empty))'
                    for='I_@(item.QizItemID)'>@Html.FixStrMiddle(@item.Title, 8)</label>
                    </span>
                }
            </li>
        }
    </ul>
    
}
